package com.lagou.resume.service.impl;

import com.lagou.resume.dao.UserDao;
import com.lagou.resume.pojo.User;
import com.lagou.resume.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;

/**
 * 用户管理的业务层实现类
 * @autor yangzhenhao
 */
@Service("userService")
@Transactional
public class UserServiceImpl implements IUserService {

    @Autowired
    private UserDao userDao;

    @Override
    public User login(User userInfo) {
        List<User> userList = userDao.findByUserInfo(userInfo.getUserid(), userInfo.getPassword());
        User user = null;
        if(userList != null && userList.size() > 0) {
            user = userList.get(0);
        }
        return user;
    }
}
